package calao.test;

public class Timer 
{
	
	long start;
	long stop;
	
	public Timer()
	{ }
	
	public void start()
	{
		this.start = System.currentTimeMillis();
		stop = -1;
	}
	
	public void stop()
	{
		this.stop = System.currentTimeMillis(); 
	}
	
	@Override
	public String toString()
	{
		long time = stop!=-1? stop - start : System.currentTimeMillis() - start;
		if (time>1000) return (time/1000)+"s "+(time%1000)+"ms";
		else return (time%1000)+"ms";
	}

}
